/**
 * Created by zhangligang
 * Email: tzhang2450@163.com
 * Date: 2018/8/7
 * Time: 上午5:44
 */
$(function () {
    loadList('/v1/teacher/notice/list.json');
});
function loadList(url) {
    $("#notice-table").bootstrapTable({
        url: url,
        ajaxOptions:{
            headers: {"Authorization": $.cookie()._token}
        },
        pagination: true,
        iconSize: "outline",
        pageList: [10, 20, 50, 100],
        sortable: true,
        sortOrder: 'desc',
        striped: true,
        sortStable: true,
        sidePagination: 'server',
        icons: {
            refresh: "glyphicon-repeat",
            columns: "glyphicon-list"
        },
        columns: [{
            field: 'id',
            title: 'ID'
        }, {
            field: 'title',
            title: '标题'
        }, {
            field: 'created_at',
            title: '发布时间'
        }, {
            field: 'type',
            title: '类型',
            formatter: function (value) {
                switch (value) {
                    case 1 : return '项目公示';
                    case 2 : return '重要通知';
                    case 3 : return '政策福利';
                }
            }
        }, {
            field: 'id',
            title: '操作',
            formatter: function (value, row) {
                return '<a class="btn btn-xs btn-info view-rent" href="/teacher/notice/'+value+'.html">详情</a>';
            }
        }]
    });
}